   <!DOCTYPE html>
<html>
<head>
<head />
<div th:include="base-libs :: base-libs" />
<title>服务履约</title>
<style type="text/css">
.topBtn{
	float: right;
	margin-right:10px;
	margin-top:5px
}
.star-box {
    display: inline-block;
    position: relative;
    vertical-align: middle; }
    .star-box > ul > li {
      float: left; }
      .star-box > ul > li > a.star {
        width: 1.33333rem;
        height: 1.33333rem;
        background: url("../css/images/gray-star.png") no-repeat;
        background-size: cover;
        vertical-align: middle;
        display: inline-block;
        float: left;
        margin-right: 0.47619rem; }
      .star-box > ul > li.active a.star {
        background: url("../css/images/red-star.png") no-repeat;
        background-size: cover; }

</style>
</head>
<script th:inline="javascript">
	/**医联体信息*/
	var qysqxx = [[${qysqxx}]];
	/**用户信息*/
	var userInfo = [[${userInfo}]];
	/**服务管理信息*/
	var fwglxx = [[${fwglxx}]];
	/**履约记录*/
	var lyjl = [[${lyjl}]];
</script>
<script type="text/javascript">
	$(function() {
		initData(); 
		initView();
	});

	function initData() {
		/**加载医联体信息*/
		initQysqxx();
		/**加载提供服务机构信息*/
		if(userInfo){
			$("#CZRYID").val(userInfo["USERID"]);
			$("#CZRYMC").val(userInfo["XM"]);
		}
		
		
		/**服务管理信息*/
		if(fwglxx){
			$(".fwgl").each(function(){
				$(this).text(fwglxx[$(this).attr("id")]);
			});
			if(fwglxx["XZBL"]=="0"){
				$("#BLTR").hide();
			}else if(fwglxx["XZBL"]=="1"){
				$("#BLTR").show();
				$("#BLXZ").text(fwglxx["HZXM"]+"\t"+fwglxx["ZDMC"]);
			}
			$("#JSFWJG").text(fwglxx["JSFWJG"]);
			$("#TGFWJGMC").text(fwglxx["TGFWJGMC"]);
			$("#FWGLID").val(fwglxx["FWGLID"]);
		}
		 
		if(!$.isEmptyObject(lyjl)){
			$(".fwly").each(function(){
				$(this).attr("readonly","readonly");
				$(this).val(lyjl[$(this).attr("id")]);
			});
			/**服务评价*/
			var fwpj = parseInt(lyjl["FWPJ"]);
			$(".star-box").find("li").each(function(index) {
				if(index < fwpj){
					$(this).addClass("active");
				}
			});
			$("#SJFWSJ").attr("disabled","disabled");
			$("#btnSave").hide();
		}else{
			$(".star-box").each(function(index) {
				var $li = $(this).find("li");
				var $active = $(this).find("active");
				var i = iScore = iStar = 0;
				$li.click(function() {
					var index = $(this).index() + 1;
					iStar = $(this).index() + 1;
					curPoint($li, index);
				});
			});
		}
	}

	function initView(){
		/**提交按钮*/
		$("#btnSave").on("click", function(){
			if($(".form-control").QuickValidate() && validatePj()){
				var params = {};
				var num = 0;
				$(".star-box").find("li").each(function(){
					if($(this).hasClass("active")){
						num += 1;
					}
				});
				params["FWPJ"] = ""+num;
				$.QuickRemote.AjaxFiledFormSubmit("managerForm", function(result) { 
					var info = result["info"];
					if (result["state"]) {
						$.QuickAlert.alertNormal("保存履约记录成功！",{callback: function(){
							$.QuickUrlUtils.redirectUrl("index.html");
						}});
					} else {
						$.QuickAlert.alertFail({
							content : info["faultInfo"]
						});
					}
				}, params);
			}
		});
	}
	
	/**返回按钮*/
	function btnBackHandler() {
		$.QuickUrlUtils.redirectUrl("index.html");
	}
	
	/**加载医联体信息*/
	function initQysqxx(){
		if(qysqxx){
			$(".yltxx").each(function(){
				$(this).text(qysqxx[$(this).attr("id")]);
			});
		}
	}
	
	
	function curPoint($li, pNum) {
		if (pNum) {
			iScore = pNum;
		} else {
			iScore = iStar;
		}
		for (i = 0; i < $li.length; i++) {
			if (i < iScore) {
				$li.eq(i).addClass("active");
			} else {
				$li.eq(i).removeClass("active");
			}
		}
	}
	
	function validatePj(){
		var flag = true;
		var num = 0;
		$(".star-box").find("li").each(function(){
			if($(this).hasClass("active")){
				num += 1;
			}
		});
		if(num == 0){
			flag = false;
			$.QuickAlert.alertFail({
				content : "请评价服务！"
			});
		}
		return flag;
	}
</script>

<body style="overflow-y: scroll">
<div id="maxDiv" style="height: 670px;">
	<div id="maxLayout" class="easyui-layout" fit="true">
		<div region="center" style="border: none; overflow: hidden;">
			<h4 class="h4-title" style="font-size: 18px;text-align:center;">
				新建服务
			</h4>
			<div class="form-table-box" >
				<form id="managerForm" class="form-horizontal" action="save">
					<h4 class="h4-title" style="font-size: 13px;">
						医联体信息
					</h4>
					<table class="form-table">
						<tr>
							<td class="td-text">医联体名称：</td>
							<td class="td-content">
								<span id="YLTMC" class="yltxx" type="text">
								</span>
							</td>
							<td class="td-text">医联体类型：</td>
							<td class="td-content">
								<span id="YLTLXMC" class="yltxx"></span>
							</td>
							<td class="td-text">主导医疗机构：</td>
							<td class="td-content">
								<span id="ZDYLJGMC" class="yltxx"></span>
							</td>
						</tr>
						<tr>
							<td class="td-text">签约有效期：</td>
							<td class="td-content">
								<span id="QYYXQMC" class="yltxx"></span>
							</td>
							<td class="td-text">签约时间：</td>
							<td class="td-content">
								<span id="QYSJ" class="yltxx"></span>
							</td>
							<td class="td-text">至</td>
							<td class="td-content">
								<span id="DQSJ" class="yltxx"></span>
							</td> 
						</tr>
					</table>
					<h4 class="h4-title" style="font-size: 13px;">
						服务信息
					</h4>
					<table class="form-table ">
						<tr>
							<td class="td-text">提供服务机构：</td>
							<td class="td-content">
								<span id="TGFWJGMC"></span>
							</td>
							<td class="td-text">接收服务机构：</td>
							<td class="td-content">
								<span id="JSFWJG" class="fwgl"></span>
							</td>
							<td class="td-text">预期服务时间：</td>
							<td class="td-content">
								<span id="YQFWSJ" class="fwgl"></span>
							</td>
						</tr>
						<tr>
							<td class="td-text">服务项：</td>
							<td class="td-content" colspan="5">
								<span id="FWMC" class="fwgl"></span>
							</td>
						</tr>
						<tr>
							<td class="td-text">服务内容：</td>
							<td class="td-content" colspan="5">
								<span id="FWNR" class="fwgl"></span>
							</td>
						</tr>
						<tr id="BLTR">
							<td class="td-text">病例选择：</td>
							<td class="td-content" colspan="5">
								<span id="BLXZ" class="fwgl"></span>
							</td>
						</tr>
						<tr>
							<td class="td-text">备注：</td>
							<td class="td-content" colspan="5">
								<span id="BZ" class="fwgl"></span>
							</td>
						</tr>
					</table>
					<h4 class="h4-title" style="font-size: 13px;">
						履约信息
					</h4>
					<table class="form-table ">
						<tr>
							<td class="td-text">实际服务时间：</td>
							<td class="td-content">
								<input id="SJFWSJ" name="SJFWSJ"  style="width:85%;height:30px;"
									class="form-control input-text laydate-icon fwly" onclick="laydate()"  readonly="readonly"
									quick-config="label:'实际服务时间', validateProxy:'notNull'"/>
							</td>
							<td class="td-text">操作人员：</td>
							<td class="td-content">
								<input id="CZRYMC" class="fwly" readonly="readonly"/>
								<input id="CZRYID" name="CZRYID" style="display:none;"/>
								<input id="method" name="method" style="display:none;" value="fwly"/>
								<input id="FWGLID" name="FWGLID" style="display:none;"/>
							</td>
						</tr>
						<tr>
							<td class="td-text">服务评价：</td>
							<td class="td-content" colspan="3" style="text-align:center">
								<div class="star-box">
									<ul>
										<li><a class="star"></a></li>
										<li><a class="star"></a></li>
										<li><a class="star"></a></li>
										<li><a class="star"></a></li>
										<li><a class="star"></a></li>
									</ul>
								</div>
							</td>
						</tr>
						<tr>
							<td class="td-text">评价：</td>
							<td class="td-content" colspan="5">
								<input id="LYBZ" name="LYBZ" class="form-control fwly" style="width:96%;" type="text">
							</td>
						</tr>
					</table>
				</form>
			</div>
			<div style="text-align:center;margin-top:10px">
				<button class="btn" type="button" id="btnSave">提交</button>
				<button class="btn" type="button" onclick="btnBackHandler()">返回</button>
			</div>
		</div>
	</div>
</div>
</body>
</html>


